//
//  NCPictureViewerBar.m
//  BaiduTravel
//
//  Created by neusoft on 8/18/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "NCPictureViewerBar.h"

#define kOriginalBackgroundImageFile	@"original_navi.png"
#define kPicViewerNaviBarFrame          CGRectMake(0, 0, 320, 53)

#define kIntZero					    0
#define kSystemAnimationDuration	    0.3
#define kStatusBarheight			    20
#define kDefaultBarheight			    50

@implementation NCPictureViewerBar

@synthesize viewerBarShow = _viewerBarShow;

- (void)drawRect:(CGRect)rect
{
	//[super drawRect:rect];
	
	self.backgroundColor = [UIColor clearColor];
    
//    self.frame = kPicViewerNaviBarFrame;
    
    UIImage *backgroundImage = [UIImage imageNamed:kOriginalBackgroundImageFile];
    
	// Draw the background image
	[backgroundImage drawInRect:CGRectMake(kIntZero, kIntZero, rect.size.width, rect.size.height)];
}

- (void)showPicViewBarAnimated:(BOOL)animated
{
    if (animated)
	{
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:kSystemAnimationDuration];
	}
	//self.frame = CGRectMake(self.frame.origin.x, kIntZero, self.frame.size.width, self.frame.size.height);
	self.alpha = 1.0;
	if (animated)
	{
		[UIView commitAnimations];
	}
    _viewerBarShow = NO;
}

- (void)hidePicViewBarAnimated:(BOOL)animated
{
    if (animated)
	{
		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:kSystemAnimationDuration];
	}
	//self.frame = CGRectMake(self.frame.origin.x, -kDefaultBarheight, self.frame.size.width, self.frame.size.height);
	self.alpha = 0.0;
	if (animated)
	{
		[UIView commitAnimations];
	}
    _viewerBarShow = YES;
}

@end
